<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" href="css/bootstrap.min.css" />
		<script type="text/javascript" src="js/jquery.js"></script>
		<link rel="stylesheet" href="css/jquery-ui.min.css" />
		<link rel="stylesheet" href="css/chosen.css" />
		<link rel="stylesheet" href="css/dropzone.css" />
		<script type="text/javascript" src="js/jquery-ui.min.js"></script>
		<script type="text/javascript" src="js/jq-extends.js"></script>
		<script type="text/javascript" src="js/bootstrap.min.js"></script>
		<script type="text/javascript" src="css/chosen.jquery.js"></script>
		<script type="text/javascript" src="js/jquery.iframe-transport.js"></script>
		<script type="text/javascript" src="js/jquery.fileupload.js"></script>
		<script type="text/javascript" src="js/nojs.js"></script>
		<script>

			$(function() {
				
				$('#fileupload').fileupload({
					dataType: 'json',
					url:"http://192.168.1.199/wroot-blog/console/ajax/upfile",
					done: function(e, data) {
					//	$("tr:has(td)").remove();
						$.each(data.result, function(index, file) {
							console.info(index);
							console.info(JSON.stringify(file));
						/*	$("#uploaded-files").append(
									$('<tr/>')
									.append($('<td/>').text(file.fileName))
									.append($('<td/>').text(file.fileSize))
									.append($('<td/>').text(file.fileType))
									.append($('<td/>').html("<a href='http://192.168.1.199/wroot-blog//console/ajax/upfile" + index + "'>Click</a>"))
								) *///end $("#uploaded-files").append()
						});
					},

					progressall: function(e, data) {
						var progress = parseInt(data.loaded / data.total * 100, 10);
						$('#progress .bar').css(
							'width',
							progress + '%'
						);
					},

					dropZone: $('#dropzone')
				});
			});
		</script>
	</head>

	<body>

		<h1>Spring MVC - jQuery File Upload</h1>
		<div style="width:500px;padding:20px">

			<input id="fileupload" type="file" name="files[]"  >

			<div id="dropzone">Drop files here</div>

			<div id="progress">
				<div style="width: 0%;"></div>
			</div>

			<table id="uploaded-files">
				<tr>
					<th>File Name</th>
					<th>File Size</th>
					<th>File Type</th>
					<th>Download</th>
				</tr>
			</table>

		</div>
	</body>

</html>